package com.veterinaria.actions;

import java.util.ArrayList;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionSupport;
import com.veterinaria.bean.CitaBean;
import com.veterinaria.bean.LocalBean;
import com.veterinaria.bean.ServicioBean;
import com.veterinaria.services.LocalImplements;
import com.veterinaria.services.ServicioImplements;

@ParentPackage(value="ProyVeterinaria")
public class CitaAction extends ActionSupport{
	
	private CitaBean citabean=new CitaBean();
	private CitaBean parametroCita=new CitaBean();
	
	LocalImplements localImp=new LocalImplements();
	ServicioImplements servicioImp=new ServicioImplements();
	
	ArrayList<LocalBean> listarLocal;
	ArrayList<ServicioBean> listarServicio;
	
	@Action( value="AConsultarCita",results={@Result(name="success",location="T_listarCita",type="tiles")})
	public String consultarCita(){
		return SUCCESS;
	}
	
	@Action( value="JSONCargarLocal",results={@Result(name="success",type="json")})
	public String cargarLocal() throws Exception{
		listarLocal=localImp.listarLocales();
		return SUCCESS;
	}
	
	@Action( value="JSONCargarServicio",results={@Result(name="success",type="json")})
	public String cargarServicio() throws Exception{
		listarServicio=servicioImp.listarServicios();
		return SUCCESS;
	}

	public CitaBean getCitabean() {
		return citabean;
	}

	public void setCitabean(CitaBean citabean) {
		this.citabean = citabean;
	}

	public CitaBean getParametroCita() {
		return parametroCita;
	}

	public void setParametroCita(CitaBean parametroCita) {
		this.parametroCita = parametroCita;
	}

	public ArrayList<LocalBean> getListarLocal() {
		return listarLocal;
	}

	public void setListarLocal(ArrayList<LocalBean> listarLocal) {
		this.listarLocal = listarLocal;
	}

	public ArrayList<ServicioBean> getListarServicio() {
		return listarServicio;
	}

	public void setListarServicio(ArrayList<ServicioBean> listarServicio) {
		this.listarServicio = listarServicio;
	}

}
